import Vue from 'vue'
import Router from 'vue-router'

// 匹配项目路由
import Home from '@/components/Home/Home'
import Login from '@/components/Login/Login'
import Register from '@/components/Login/Register'
import Course from '@/components/Course/Course'
import CourseDetail from "@/components/Course/Detail";
import Player from '@/components/common/Player';
import Cart from '@/components/shopping/Cart'
import Order from '@/components/shopping/Order'
import Success from '@/components/shopping/Success'
import User from '@/components/User/User'
import UserOrder from '@/components/User/UserOrder'

Vue.use(Router)
// 路由匹配规则

export default new Router({
  mode:'history',
  routes: [
    {
      path:'/',
      name:'Home',
      component:Home
    },
    {
      path:'/home',
      name:'Home',
      component:Home
    },
    {
      path:'/login',
      name:'Login',
      component:Login
    },
    {
      path:'/register',
      name:'Register',
      component:Register
    },
    {
      path:'/course',
      name:'Course',
      component:Course
    },
    {
      path:'/detail',
      name:'CourseDetail',
      component:CourseDetail
    },
      {
       name:"Player",
       path:"/player",
       component: Player,
     },
    {
      name:"Cart",
      path:'/cart',
      component:Cart
    },
    {
       name:"Order",
       // 地址栏的命名绑定参数, 在组件中可以通过 this.$router.param.order可以获取数据
       path:"/orders/:order",
       component: Order,
     },
    {
       name:"Success",
       // 地址栏的命名绑定参数, 在组件中可以通过 this.$router.param.order可以获取数据
       path:"/success",
       component: Success,
     },
    {
      name:"User",
      path:"/my",
      component: User,
      // children:[  // 设置子路由,在父级路由对应的组件中如果存在父子公用部分页面,可以使用router-view来实现子路由
      //   {
      //     name:"UserOrder",
      //     path:"/order",
      //     component: UserOrder,
      //   }
      // ]
    },
    {
      name:"UserOrder",
      path:"/my/order",
      component: UserOrder,
    },
  ]
})
